<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets">
    
    <h:head>
        <title>EL Test</title>
    </h:head>
    <f:view>
		<h:body>
			<center>
				<h:form id="form">
	
				    <p:dataTable style="width: 50%" id="multiCars" var="car" value="#{tableBean.mediumCarsModel}" paginator="true" rows="15"
				                 selection="#{tableBean.selectedCars}">
				
				        <f:facet name="header">
				            Checkbox Based Selection
				        </f:facet>
				
				        <p:column selectionMode="multiple" style="width:18px" />
				
				        <p:column headerText="Model">
				            #{car.name}  
				        </p:column>
				        
				         <p:column headerText="Model">
				            #{car.currentStatus}  
				        </p:column>
				
				        <f:facet name="footer">
				            <p:commandButton id="multiViewButton" value="View" icon="ui-icon-search"
				                             update=":form:displayMulti" oncomplete="multiCarDialog.show()"/>
				        </f:facet>
				    </p:dataTable>
				
				    <p:dialog id="multiDialog" header="Car Detail" widgetVar="multiCarDialog"
				              height="300" width="250" showEffect="fade" hideEffect="explode">
				
				        <p:dataList id="displayMulti"
				                value="#{tableBean.selectedCars}" var="selectedCar">
				            Name: #{selectedCar.name}  Status: #{selectedCar.currentStatus}
				        </p:dataList>
				        
				        <table>
							<tr>
								<td><h:outputLabel>Change Status to:</h:outputLabel> </td>
								<td>
									<p:selectOneRadio id="options"
										value="#{tableBean.newStatus}">
										<f:selectItem itemLabel="Enable" itemValue="true" />
										<br />
										<f:selectItem itemLabel="Disable" itemValue="false" />
									</p:selectOneRadio>
								</td>
							</tr>			        	
				        </table>
						<p:commandButton id="submit" value="Submit" type="submit" ajax="false" action="#{tableBean.perform}"/>
				    </p:dialog>
				</h:form>
			 </center>
       </h:body>
    </f:view>
</html>
                    